package com.gxc.healthfood.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxc.healthfood.entity.UserPreferences;
import com.gxc.healthfood.service.UserPreferencesService;
import com.gxc.healthfood.mapper.UserPreferencesMapper;
import org.springframework.stereotype.Service;

/**
* @author hasee
* @description 针对表【user_preferences】的数据库操作Service实现
* @createDate 2025-10-03 16:14:50
*/
@Service
public class UserPreferencesServiceImpl extends ServiceImpl<UserPreferencesMapper, UserPreferences>
    implements UserPreferencesService{

    /**
     * 根据用户ID查询用户偏好信息
     * @param userId 用户ID
     * @return 用户偏好信息
     */
    @Override
    public UserPreferences getByUserId(Long userId) {
        LambdaQueryWrapper<UserPreferences> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserPreferences::getUserId, userId);
        return this.getOne(queryWrapper);
    }
}




